<template>
    <view class="network_error" @touchmove.stop.prevent="() => {}">
        <view class="image">
            <image class="pic" :src="getImgOssUrl('/ui-prod-2.15.0/network_error.png')" @error="errorHandle" />
        </view>
        <view class="desc">
            <text>{{ errorText }}</text>
        </view>
        <view class="button" @click="$emit('tautology')">
            <text>刷新</text>
        </view>
    </view>
</template>

<script setup>
import { getImgOssUrl } from '@/commons/utils.js';
import { ref } from 'vue';

const errorText = ref('网络异常，请稍后重试。');
const errorHandle = e => {
    errorText.value = '网络连接不稳定，请稍后再试。';
};
</script>

<style lang="scss" scoped>
.network_error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    .image {
        .pic {
            width: 334rpx;
            height: 252rpx;
        }
    }
    .desc {
        height: 40rpx;
        margin-bottom: 44rpx;
        font-size: 29rpx;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #333333;
        line-height: 40rpx;
    }
    .button {
        width: 192rpx;
        height: 65rpx;
        background: linear-gradient(270deg, #ff5356 0%, #fe292b 100%);
        border-radius: 40rpx;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #ffffff;
        text-align: center;
        line-height: 65rpx;
    }
}
</style>
